﻿using RuoYi.Framework.Entity;

namespace RuoYi.Framework.Repository;

/// <summary>
/// Repository interface
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <typeparam name="TPrimaryKey"></typeparam>
public interface IRepository<TEntity, TPrimaryKey> : IRepository<TEntity>, IRepository where TEntity : class, IEntity
{
    /// <summary>
    /// Gets an entity with given id.
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    TEntity Get(TPrimaryKey id);
    /// <summary>
    /// Gets an entity with given id.
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    Task<TEntity> GetAsync(TPrimaryKey id);

    /// <summary>
    /// Delete an entity with given id.
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    bool Delete(TPrimaryKey id);
    /// <summary>
    /// Delete an entity with given id.
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    Task<bool> DeleteAsync(TPrimaryKey id);
}
